<!DOCTYPE html>
<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
	<title>权限管理系统 -  修改用户信息</title>
	<meta th:remove="tag" th:include="base/include :: head" />
	<script type="text/javascript">
		$(function(){
			//左边当前菜单高亮，inculde里定义
			activeLeftNav("usermanage");
			
			$(".form-horizontal").submit(function(form){
				var newPassword = $.trim($("#newPassword").val());
				var confirmPassword = $.trim($("#confirmPassword").val());
				if(newPassword!=confirmPassword){
					alert("确认密码与新密码不一致！")
					return false ;
				}
				
				form.submit();
			});
		});
	</script>
	<style type="text/css">
		.requireFlag{font-size:21px;}
	</style>
</head>
<body>
	<!-- 头部 -->
	<div th:replace="base/include :: top"></div>

    <div class="container-fluid">
      <div class="row">
        <!-- 左边菜单 -->
        <div th:replace="base/include :: left"></div>
        
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        	<ol class="breadcrumb">
			  <li><a th:href="@{/}" href="#">主页</a></li>
			  <li><a th:href="@{/user/findUsers}" href="#">用户管理</a></li>
			  <li class="active">修改用户信息</li>
			</ol>
			<form class="form-horizontal" role="form" th:action="@{/user/saveInfo}" th:object="${userinfo}" method="post">
			  <input type="hidden" id="id" name="id" th:value="*{id}" />
			  <input type="hidden" id="accountNonLocked" name="accountNonLocked" th:value="*{accountNonLocked}" />
			  <input type="hidden" id="credentialsNonExpired" name="credentialsNonExpired" th:value="*{credentialsNonExpired}" />
			  <input type="hidden" id="accountNonExpired" name="accountNonExpired" th:value="*{accountNonExpired}" />
			  <input type="hidden" id="enabled" name="enabled" th:value="*{enabled}" />
			  <div class="form-group">
			    <label for="username" class="col-sm-4 control-label">登录账号</label>
			    <div class="col-sm-4 input-group">
			      		<input type="text" class="form-control" id="username"  required="required"
			      				name="username" placeholder="请输入登录账号" autofocus="true" th:value="*{username}" />
			      		<span class="input-group-addon"><strong class="text-danger requireFlag">*</strong></span>
			    </div>
			    <div class="col-sm-4"></div>
			  </div>
			  <div class="form-group">
			    <label for="password" class="col-sm-4 control-label">登录密码</label>
			    <div class="col-sm-4 input-group">
			      <input type="password" class="form-control" id="password" th:required="${(userinfo.id==null||userinfo.id==0)?'true':'false'}" 
			      				name="password" th:placeholder="${(userinfo.id==null||userinfo.id==0)?'请输入登录密码':'若不修改密码，请将此处留空'}"  />
			      <span th:unless="${userinfo.id!=null and userinfo.id>0}" class="input-group-addon"><strong class="text-danger requireFlag">*</strong></span>
			    </div>
			    <div class="col-sm-4"></div>
			  </div>
			  <div class="form-group">
			    <label for="realname" class="col-sm-4 control-label">姓名</label>
			    <div class="col-sm-4 input-group">
			      		<input type="text" class="form-control" id="realname"  required="required"
			      				name="realname" placeholder="请输入用户姓名" th:value="*{realname}" />
			      		<span class="input-group-addon"><strong class="text-danger requireFlag">*</strong></span>
			    </div>
			    <div class="col-sm-4"></div>
			  </div>
			  <div class="form-group">
			    <label for="email" class="col-sm-4 control-label">电子邮箱</label>
			    <div class="col-sm-4 input-group">
			      <input type="email" class="form-control" id="email"  required="required" 
			      				name="email" placeholder="请输入电子邮箱地址" th:value="*{email}" />
			      <span class="input-group-addon"><strong class="text-danger requireFlag">*</strong></span>				
			    </div>
			    <div class="col-sm-4"></div>
			  </div>
			  <div class="form-group">
			    <label for="mobile" class="col-sm-4 control-label">手机号码</label>
			    <div class="col-sm-4 input-group">
			      <input type="text" class="form-control" id="mobile"  required="required" 
			      				name="mobile" placeholder="请输入手机号码" th:value="*{mobile}" />
			      <span class="input-group-addon"><strong class="text-danger requireFlag">*</strong></span>				
			    </div>
			    <div class="col-sm-4"></div>
			  </div>
			  <div class="form-group">
			    <label for="telphone" class="col-sm-4 control-label">联系电话</label>
			    <div class="col-sm-4 input-group">
			      <input type="text" class="form-control" id="telphone"  
			      				name="telphone" placeholder="请输入联系电话" th:value="*{telphone}" />
			    </div>
			    <div class="col-sm-4"></div>
			  </div>
			  <div class="form-group">
			    <label for="address" class="col-sm-4 control-label">通讯地址</label>
			    <div class="col-sm-4 input-group">
			      <input type="text" class="form-control" id="address"  
			      				name="address" placeholder="请输入通讯地址" th:value="*{address}" />
			    </div>
			    <div class="col-sm-4"></div>
			  </div>
			  <div class="form-group">
			    <div class="col-sm-offset-5 col-sm-1">
			      <button type="submit" class="btn btn-primary btn-lg btn-block">提交</button>
			    </div>
			    <div class="col-sm-6"></div>
			  </div>
			</form>
          
        </div>
      </div>
    </div>
   </body>
</html>